﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class orgman_models_modelInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            MasApp.BLL.Check.CheckLogin();
            if (Request["modelid"] != null)
            {
                int modelid = Convert.ToInt32(Request.QueryString[0].ToString());
                Label lb = new Label();
                lb.Text = "<table style='border: 1px solid #66CCFF; width: 100%;' border='1'>";
                MasApp.Model.model mod = MasApp.BLL.Search.SearchModel(modelid);
                lb.Text += "模型名称：" + mod.Modelname + "<tr><td colspan=3>目标层："
                    + mod.Target + "</td></tr>";
                DataTable dt = MasApp.BLL.Search.SearchRuleIDsandNames(modelid);
                lb.Text += "<tr><td>准则层</td><td>指标层</td><td>总计</td></tr>";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataTable dt1 = MasApp.BLL.Search.SearchIndicatorIDsandNames(Convert.ToInt32(dt.Rows[i]["ruleid"].ToString()));
                    lb.Text += "<tr><td>" + (i+1).ToString() + dt.Rows[i]["rulename"].ToString() + "</td><td>&nbsp;</td><td>"
                        + dt1.Rows.Count + "个指标</td></tr>";
                    for (int j = 0; j < dt1.Rows.Count; j++)
                    {
                        lb.Text += "<tr><td></td><td>" + dt1.Rows[j]["indicatorname"].ToString() + "</td><td></td></tr>";
                    }
                }
                lb.Text += "</table>";
                form1.Controls.Clear();
                form1.Controls.Add(lb);
            }
            else
            {
                MasApp.BLL.ResponseHelper.alert("非法链接", "list.aspx");
            }
        }
    }
}
